PRO MAKE_FF_GLON_PLOT
  
  
  FORWARD_FUNCTION BGPS_FFORE_MODEL, BGPS_FFORE_LOOPIE, STAR_DENSITY, $
     FFORE_LBD
  RESOLVE_ROUTINE, 'IRDC_MORPH', /COMPILE_FULL_FILE, /EITHER, /NO_RECOMPILE
  RESOLVE_ROUTINE, 'BGPS_FFORE', /COMPILE_FULL_FILE, /EITHER, /NO_RECOMPILE
  
  ;; Get galactic params
  defsysv, '!MW', exists = exists
  IF NOT exists THEN galactic_params 
  defsysv, '!IRDC', exists = exists
  IF NOT exists THEN irdc_params 
  
  ;; Set up GLON
  nl  = 1001
  ell = dindgen(nl)*60.d / (nl-1.d) + 10.d
  ff  = dblarr(nl)
  
  ;; Calculate FF as function of GLON
  FOR i=0L, nl-1 DO BEGIN
     dtan = !MW.R0*cos(ell[i] * !dtor)
     ff[i] = FFORE_LBD(ell[i], 0.d, dtan, /NONNATIVE, /HYPERFINE)
  ENDFOR
  
  ;;====================================================================
  ;; Set up the plot environment
  myps,'./irdc_dist_model/analysis_plots/ffore_glon_tandist.eps',xsize=5
  
  plot,ell,ff,xr=[70,10],yr=[0.0,1.0],/xst,xtit='Galactic Longitude [deg]',$
       ytit='f!dfore!n at Tangent Distance',/yst,thick=6
  vline,/horiz,0.5, linestyle=1
  vline,/horiz,0.45,linestyle=1
  vline,/horiz,0.4, linestyle=1
  
  myps,/done
  
  
  
  ;;====================================================
  ;; d_helio plot
  ;;====================================================
  message,'Making d_helio plot...',/inf
  
  myps,'./irdc_dist_model/analysis_plots/ffore_dhelio_glon.eps',ysize=10
  
  sun = cgSymbol('Sun')
  deg = cgSymbol('deg')
  
  ;; Get galactic params
  defsysv, '!MW', exists = exists
  IF NOT exists THEN galactic_params 
  IF n_elements(dvec) NE 0 THEN  d = dvec ELSE $
     d = dindgen(!MW.NBINS*5.)*!MW.BINSIZE + !MW.BINSTART
  
  
  colors = ['YGB3','TG3','BLU5','RED5']
  cname  = cgColor(colors)
  ells = [25.,35.,45.,55.]
  
  
  multiplot,[1,2],/doxaxis,/doyaxis,ygap=0.04
  
  plot,[0],[0],/nodata,xr=[0,20],yr=[-0.05,1.05],xtit='d!d'+sun+'!n [kpc]',$
       ytit='f!dmodel!n',/yst
  
  FOR jj=0,3 DO $
     oplot,d/1.d3,FFORE_LBD(ells[jj],0.,d),color=cname[jj],thick=5
  
  al_legend,/bottom,/right,'GLON = '+string(ells,format="(I0)")+deg,$
            colors=colors,linestyle=0,box=0,thick=5
  
  multiplot,/doxaxis,/doyaxis
  
  plot,[0],[0],/nodata,xr=[0,3],yr=[-0.05,1.05],xtit='d!d'+sun+'!n / d!dtan!n',$
       ytit='f!dmodel!n',/yst
  vline,1.,linestyle=2,color=cgColor('PUR4'),thick=3
  
  FOR jj=0,3 DO BEGIN
     dtan = !MW.R0*cos(ells[jj] * !dtor)/1.d3
     print,'DTAN = ',dtan
     oplot,d/1.d3/dtan,FFORE_LBD(ells[jj],0.,d),color=cname[jj],thick=5
     
  ENDFOR
  
  al_legend,/bottom,/right,'GLON = '+string(ells,format="(I0)")+deg,$
            colors=colors,linestyle=0,box=0,thick=5
  
  myps,/done,/mp
  
END
